package com.topscore.uke.mvp.presenters;

import com.topscore.uke.database.entities.SearchHistoryItem;
import com.topscore.uke.mvp.contractors.SearchHistoryContractor;
import com.topscore.uke.mvp.model.SearchHistoryModel;

import java.util.List;

/**
 * Created by 71468 on 2018/3/20.
 */

public class SearchHistoryPresenter implements SearchHistoryContractor.Presenter, SearchHistoryContractor {
    private View mView;
    private Model mModel;

    public SearchHistoryPresenter(View view) {
        this.mView = view;
        mModel = new SearchHistoryModel();
    }

    @Override
    public void getSearchHistory() {
        List<SearchHistoryItem> list = mModel.getHistories();
        mView.getRecyclerAdapter().setNewData(list);
    }

    @Override
    public void insertSearchWord(String searchWord) {
        mModel.insertWord(searchWord);
    }
}
